/**
 * 枚举类型: 顾客标签分类
 */
const TagGategory = {
  TAG_1_100_XING_QU: { name: '兴趣标签', id: 1 },
  TAG_101_200_XF_NENG_LI: { name: '消费能力', id: 101 },
  TAG_101_200_XF_YI_YUAN: { name: '消费意愿', id: 102 },
  TAG_101_200_XF_CENG_JING: { name: '曾经消费', id: 103 },
  TAG_101_200_XF_DENG_JI: { name: '消费等级', id: 104 },
  TAG_101_200_XU_QIU: { name: '升单品类', id: 105 },
  TAG_101_200_CUR_PIN: { name: '当前品类', id: 106 },
  TAG_1001_1100_XG_XING_DONG: { name: '行动', id: 1001 },
  TAG_1001_1100_XG_LUO_JI: { name: '逻辑', id: 1002 },
  TAG_1001_1100_XG_CE_LUE: { name: '策略', id: 1003 },
  TAG_1001_1100_XG_GAN_XING: { name: '感性', id: 1004 },
  TAG_1001_1100_XG_NENG_LIANG: { name: '能量', id: 1005 },
  TAG_CUSTOMIZE: { name: '其他标签', id: 10000 },

  /**
   * 通过标签分类类型 id, 获取对应的枚举
   * @param {number} id 标签分类类型 id
   * @return {Object | undefined}
   */
  getById: function (id) {
    return Object.values(TagGategory)
      .filter(x => x && typeof x !== 'function')
      .find(x => x.id === id);
  },

  /**
   * 通过标签分类类型名, 获取对应的枚举
   * @param {string} name 标签分类类型名
   * @return {Object | undefined}
   */
  getByName: function (name) {
    return Object.values(TagGategory)
      .filter(x => x && typeof x !== 'function')
      .find(x => x.name === name);
  },
};

Object.freeze(TagGategory);

export default TagGategory;
